package com.mac.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Description
 * @auther machuan
 * @create 2020-04-17 14:07
 */
public class SocketServer {

    public static void main(String[] args) throws Exception {
        //创建一个serverSocket监听一个8089端口
        ServerSocket server = new ServerSocket(8089);
        while (true){
            //等待请求
            System.out.println("waiting socket.....");
            Socket socket = server.accept();
            System.out.println("accept socket ");
            new Thread(new ExecSocket(socket)).start();
        }
    }
}
